<template>
  <n-button @click="Login">我要登录</n-button>
</template>

<script setup>
import { useUserStore } from '../../store/user';

const { $router } = getCurrentInstance().appContext.config.globalProperties,
  user = useUserStore();

const Login = () => {
  $uiMsg.loading('加载中');
  setTimeout(() => {
    user.LoginIn({
      expire: 3600,
      loginName: 'admin',
      staffId: 1,
      token: 'test',
      trueName: '管理员'
    });
    $uiMsg.success('登录成功', async () => {
      $router.push('/');
    });
  }, 1500);
};
</script>
